import java.util.*;
public class Main2 {

    
    public static void main(String[] args)
    {
        Scanner s = new Scanner(System.in);
        while(s.hasNextLine()){
            String[] arr=s.nextLine().split(" ");
            int n=Integer.parseInt(arr[0]);
            String tar=arr[n+1];
            int count=0;
            for(int i=1;i<=n;i++){
                char[] str=arr[i].toCharArray();
                Arrays.sort(str);
                String sll=str.toString();
                if(tar.equals(sll)){
                    count++;
                }
            }
            System.out.println(count);
            
        }
    }
}